package com.hancai.servlet;

import com.hancai.service.EmployeeService;
import com.hancai.service.impl.EmployeeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author:Xsh
 * @Date:2025/4/28 下午4:27
 */
@WebServlet("/EmployeeRemoveServlet")
public class EmployeeRemoveServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1,接收页面的数据
        int eid = Integer.parseInt(req.getParameter("eid"));
        //2，数据的处理-返回结果
        EmployeeService emps = new EmployeeServiceImpl();
        int remove = emps.remove(eid);
        //3，跟据结果做出响应
        resp.sendRedirect(req.getContextPath()+"/EmployeeFindAllServlet");
    }
}
